From 68fd6834a82efe9894a2043fc1f69b1be8579a02 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 20 Apr 2009 17:42:59 +0000 Subject: [PATCH] Don't loop endlessly on malformed tpo3 file. --- tpo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tpo.c b/tpo.c index 372ab86dd..45a6491b2 100644 --- a/tpo.c +++ b/tpo.c @@ -210,7 +210,9 @@ tpo_read_until_section(const char* section_name, int seek_bytes) int header_size = 0; while (1) { - gbfread(&byte, 1, 1, tpo_file_in); + if (gbfread(&byte, 1, 1, tpo_file_in) < 1) { + fatal(MYNAME ": malformed input file - attempt to read past end"); + } header_size++; if (byte == section_name[match_index]) { @@ -1856,4 +1858,3 @@ ff_vecs_t tpo3_vecs = { tpo3_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ }; - -- 2.30.2